
/**
 * 
 * Class for votes in suprerlatives
 * @Azaria Zornberg and Aman Zargarpur
 * 
 */
import java.util.ArrayList;
public class Vote
{
    String idNum;
    String[] mVotes, fVotes;
    
    public Vote(String id, String[] input, String[] input2){
        //this is the constructor for Vote, it takes the voters ID number
        //it also takes arrays for male and female votes in order
        idNum = id;
        mVotes = new String[input.length];
        fVotes = new String[input2.length];
        for(int i = 0; i < mVotes.length; i++){
            mVotes[i] = input[i].trim();
            fVotes[i] = input2[i].trim();
        }
    }
    
    public String[] getMVotes(){
        //this method returns the votes cast for men
        return mVotes;
    }
    
    public String[] getFVotes(){
        //this method returns the votes cast for women
        return fVotes;
    }
    
    public String getMVoteFor(int i){
        //this method, given the category index, returns the male voted for
        return mVotes[i];
    }
    
    public String getFVoteFor(int i){
        //this method, given the category index, returns the woman voted for
        return fVotes[i];
    }
    
    public String getIDNum(){
        return idNum;
    }
    
    public boolean equals(Object o){
        //this is the equals method, it compares votes based on ID number
        Vote v1 = (Vote) o;
        return idNum.equals(v1.getIDNum());
    }
    
    public void castVote(ArrayList<Category> cats){
        //this method casts the votes for each person in each category
        for(int i = 0; i < mVotes.length; i++){
            cats.get(i).addVote(mVotes[i], true);
            cats.get(i).addVote(fVotes[i], false);
        }
    }
}
